//app.js
// polyfill for Android before app starts
import { ToastPannel } from './component/toastTest/toastTest'
if (!Array.prototype.findIndex) {
  require('./utils/array-findIndex')
}
App({
  ToastPannel,
  onLaunch: function () {
   console.log("");
  },
  //修改tabBar的active值  
  editTabBar: function () {
    var _curPageArr = getCurrentPages();
    var _curPage = _curPageArr[_curPageArr.length - 1];
    var _pagePath = _curPage.__route__;
    if (_pagePath.indexOf('/') != 0) {
      _pagePath = '/' + _pagePath;
    }
    var tabBar = this.globalData.tabBar;
    for (var i = 0; i < tabBar.list.length; i++) {
      tabBar.list[i].active = false;
      if (tabBar.list[i].pagePath == _pagePath) {
        tabBar.list[i].active = true;//根据页面地址设置当前页面状态  
      }
    }
    _curPage.setData({
      tabBar: tabBar
    });
  },
  globalData: {
        appkey:'105fbf8c023054d586a0a7874093714b08c' ,
         appsecret:'UzlOdnhubmYxTnV3M25PY2hqVUUvZz09',
    userInfo: null,
    // url:  "http://192.168.3.108:8098/business/v1.0/wechat/getalldata",//http://192.168.3.108:8098/business/v1.0/wechat/getalldata
    //https://bmc.huochexia.com/business/v1.0/wechat/getalldata
    url:"https://bmc.huochexia.com/business/v1.0/wechat/getalldata",
    //配置tabBar  
    tabBar: {
      "color": "#9E9E9E",
      "selectedColor": "#f00",
      "backgroundColor": "#fff",
      "borderStyle": "#ccc",
      
      "list": [
        {
          "pagePath": "/pages/order/order",
          "text": "运单管理",
          "iconPath": "/images/icon_order_unclick@3x.png",
          "selectedIconPath": "/images/icon_order_click@3x.png",
          "selectedColor": "#13b7f6",
          active: false
        },

        {
          "pagePath": "/pages/hisorder/hisorder",
          "text": "我的车队",
          "iconPath": "/images/icon_car_unclick@3x.png",
          "selectedIconPath": "/images/icon_car_click@3x.png",
          "selectedColor": "#13b7f6",
          active: false
        },
        {
          "pagePath": "/pages/userinfo/userinfo",
          "text": "个人中心",
          "iconPath": "/images/icon_personal_n@3x.png",
          "selectedIconPath": "/images/icon_personal_h@3x.png",
          "selectedColor": "#13b7f6",
          active: false
        },
      ],
      "position": "bottom"
    }
  }
})